<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWheelEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWheelEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QWheelEvent class contains parameters that describe a wheel
event. <a href="#details">More...</a></p>

<p>Inherits <a href="qinputevent.html">QInputEvent</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwheelevent.html#QWheelEvent">__init__</a></b> (<i>self</i>, QPoint&#160;<i>pos</i>, int&#160;<i>delta</i>, Qt.MouseButtons&#160;<i>buttons</i>, Qt.KeyboardModifiers&#160;<i>modifiers</i>, Qt.Orientation&#160;<i>orientation</i>&#160;=&#160;Qt.Vertical)</li><li><div class="fn" /><b><a href="qwheelevent.html#QWheelEvent-2">__init__</a></b> (<i>self</i>, QPoint&#160;<i>pos</i>, QPoint&#160;<i>globalPos</i>, int&#160;<i>delta</i>, Qt.MouseButtons&#160;<i>buttons</i>, Qt.KeyboardModifiers&#160;<i>modifiers</i>, Qt.Orientation&#160;<i>orientation</i>&#160;=&#160;Qt.Vertical)</li><li><div class="fn" /><b><a href="qwheelevent.html#QWheelEvent-3">__init__</a></b> (<i>self</i>, QWheelEvent)</li><li><div class="fn" />Qt.MouseButtons <b><a href="qwheelevent.html#buttons">buttons</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwheelevent.html#delta">delta</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qwheelevent.html#globalPos">globalPos</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwheelevent.html#globalX">globalX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwheelevent.html#globalY">globalY</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Orientation <b><a href="qwheelevent.html#orientation">orientation</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qwheelevent.html#pos">pos</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwheelevent.html#x">x</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwheelevent.html#y">y</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWheelEvent class contains parameters that describe a wheel
event.</p>
<p>Wheel events are sent to the widget under the mouse cursor, but
if that widget does not handle the event they are sent to the focus
widget. The rotation distance is provided by <a href="qwheelevent.html#delta">delta</a>(). The functions <a href="qwheelevent.html#pos">pos</a>() and <a href="qwheelevent.html#globalPos">globalPos</a>() return the mouse
cursor's location at the time of the event.</p>
<p>A wheel event contains a special accept flag that indicates
whether the receiver wants the event. You should call <a href="qevent.html#ignore">ignore</a>() if you do not handle the wheel
event; this ensures that it will be sent to the parent widget.</p>
<p>The <a href="qwidget.html#enabled-prop">QWidget.setEnabled</a>() function can
be used to enable or disable mouse and keyboard events for a
widget.</p>
<p>The event handler <a href="qwidget.html#wheelEvent">QWidget.wheelEvent</a>() receives wheel
events.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWheelEvent" />QWheelEvent.__init__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, int&#160;<i>delta</i>, <a href="qt-mousebuttons.html">Qt.MouseButtons</a>&#160;<i>buttons</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifiers</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>orientation</i>&#160;=&#160;Qt.Vertical)</h3><p>Constructs a wheel event object.</p>
<p>The position, <i>pos</i>, is the location of the mouse cursor
within the widget. The <a href="qwheelevent.html#globalPos">globalPos</a>() is initialized to
<a href="qcursor.html#pos">QCursor.pos</a>() which is usually, but
not always, correct. Use the other constructor if you need to
specify the global position explicitly.</p>
<p>The <i>buttons</i> describe the state of the mouse buttons at
the time of the event, <i>delta</i> contains the rotation distance,
<i>modifiers</i> holds the keyboard modifier flags at the time of
the event, and <i>orient</i> holds the wheel's orientation.</p>
<p><b>See also</b> <a href="qwheelevent.html#pos">pos</a>(),
<a href="qwheelevent.html#delta">delta</a>(), and <a class="compat" href="qwheelevent-qt3.html#state">state</a>().</p>


<h3 class="fn"><a name="QWheelEvent-2" />QWheelEvent.__init__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, <a href="qpoint.html">QPoint</a>&#160;<i>globalPos</i>, int&#160;<i>delta</i>, <a href="qt-mousebuttons.html">Qt.MouseButtons</a>&#160;<i>buttons</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifiers</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>orientation</i>&#160;=&#160;Qt.Vertical)</h3><p>Constructs a wheel event object.</p>
<p>The <i>pos</i> provides the location of the mouse cursor within
the widget. The position in global coordinates is specified by
<i>globalPos</i>. <i>delta</i> contains the rotation distance,
<i>modifiers</i> holds the keyboard modifier flags at the time of
the event, and <i>orient</i> holds the wheel's orientation.</p>
<p><b>See also</b> <a href="qwheelevent.html#pos">pos</a>(),
<a href="qwheelevent.html#globalPos">globalPos</a>(), <a href="qwheelevent.html#delta">delta</a>(), and <a class="compat" href="qwheelevent-qt3.html#state">state</a>().</p>


<h3 class="fn"><a name="QWheelEvent-3" />QWheelEvent.__init__ (<i>self</i>, <a href="qwheelevent.html">QWheelEvent</a>)</h3><h3 class="fn"><a name="buttons" /><a href="qt-mousebuttons.html">Qt.MouseButtons</a> QWheelEvent.buttons (<i>self</i>)</h3><p>Returns the mouse state when the event occurred.</p>


<h3 class="fn"><a name="delta" />int QWheelEvent.delta (<i>self</i>)</h3><p>Returns the distance that the wheel is rotated, in eighths of a
degree. A positive value indicates that the wheel was rotated
forwards away from the user; a negative value indicates that the
wheel was rotated backwards toward the user.</p>
<p>Most mouse types work in steps of 15 degrees, in which case the
delta value is a multiple of 120; i.e., 120 units * 1/8 = 15
degrees.</p>
<p>However, some mice have finer-resolution wheels and send delta
values that are less than 120 units (less than 15 degrees). To
support this possibility, you can either cumulatively add the delta
values from events until the value of 120 is reached, then scroll
the widget, or you can partially scroll the widget in response to
each wheel event.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>wheelEvent(<span class="type"><a href="qwheelevent.html">QWheelEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="type">int</span> numDegrees <span class="operator">=</span> event<span class="operator">-</span><span class="operator">&gt;</span>delta() <span class="operator">/</span> <span class="number">8</span>;
     <span class="type">int</span> numSteps <span class="operator">=</span> numDegrees <span class="operator">/</span> <span class="number">15</span>;

     <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>orientation() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Horizontal) {
         scrollHorizontally(numSteps);
     } <span class="keyword">else</span> {
         scrollVertically(numSteps);
     }
     event<span class="operator">-</span><span class="operator">&gt;</span>accept();
 }
</pre>


<h3 class="fn"><a name="globalPos" /><a href="qpoint.html">QPoint</a> QWheelEvent.globalPos (<i>self</i>)</h3><p>Returns the global position of the mouse pointer <i>at the time
of the event</i>. This is important on asynchronous window systems
such as X11; whenever you move your widgets around in response to
mouse events, globalPos() can differ a lot from the current cursor
position returned by <a href="qcursor.html#pos">QCursor.pos</a>().</p>
<p><b>See also</b> <a href="qwheelevent.html#globalX">globalX</a>()
and <a href="qwheelevent.html#globalY">globalY</a>().</p>


<h3 class="fn"><a name="globalX" />int QWheelEvent.globalX (<i>self</i>)</h3><p>Returns the global x position of the mouse cursor at the time of
the event.</p>
<p><b>See also</b> <a href="qwheelevent.html#globalY">globalY</a>()
and <a href="qwheelevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="globalY" />int QWheelEvent.globalY (<i>self</i>)</h3><p>Returns the global y position of the mouse cursor at the time of
the event.</p>
<p><b>See also</b> <a href="qwheelevent.html#globalX">globalX</a>()
and <a href="qwheelevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="orientation" /><a href="qt.html#Orientation-enum">Qt.Orientation</a> QWheelEvent.orientation (<i>self</i>)</h3><p>Returns the wheel's orientation.</p>


<h3 class="fn"><a name="pos" /><a href="qpoint.html">QPoint</a> QWheelEvent.pos (<i>self</i>)</h3><p>Returns the position of the mouse cursor relative to the widget
that received the event.</p>
<p>If you move your widgets around in response to mouse events, use
<a href="qwheelevent.html#globalPos">globalPos</a>() instead of
this function.</p>
<p><b>See also</b> <a href="qwheelevent.html#x">x</a>(), <a href="qwheelevent.html#y">y</a>(), and <a href="qwheelevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="x" />int QWheelEvent.x (<i>self</i>)</h3><p>Returns the x position of the mouse cursor, relative to the
widget that received the event.</p>
<p><b>See also</b> <a href="qwheelevent.html#y">y</a>() and
<a href="qwheelevent.html#pos">pos</a>().</p>


<h3 class="fn"><a name="y" />int QWheelEvent.y (<i>self</i>)</h3><p>Returns the y position of the mouse cursor, relative to the
widget that received the event.</p>
<p><b>See also</b> <a href="qwheelevent.html#x">x</a>() and
<a href="qwheelevent.html#pos">pos</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>